package com.audaque.springboot.foshanupload.web.mpjdemo.mpgt.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.List;
import com.audaque.springboot.foshanupload.core.result.R;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;


import com.audaque.springboot.foshanupload.web.mpjdemo.mpgt.service.IActNodeDefService;
import com.audaque.springboot.foshanupload.web.mpjdemo.mpgt.model.entity.ActNodeDef;
import com.audaque.springboot.foshanupload.web.mpjdemo.mpgt.model.req.ActNodeDefReq;

import org.springframework.beans.factory.annotation.Autowired;



import io.swagger.annotations.*;


/**
 * <p>
 * 流程节点定义 前端控制器
 * </p>
 *
 * @author chinaben
 * @since 2023-04-07
 */
@RestController

@Api(value = "流程节点定义 前端控制器")

@RequestMapping("/actNodeDef")
public class ActNodeDefController {


    @Autowired
    private IActNodeDefService iActNodeDefService;

    @PostMapping(value = "/")
    @ApiOperation(value = "流程节点定义 分页查询")
    public R<Page<ActNodeDef>> page(@RequestBody ActNodeDefReq req) {
        QueryWrapper queryWrapper = new QueryWrapper(req);
        Page<ActNodeDef> page = iActNodeDefService.page(new Page<ActNodeDef>(req.getPage(),  req.getRows()),queryWrapper);
        return R.ok(page);
    }




    @PostMapping(value = "/list")
    @ApiOperation(value = "流程节点定义 列表查询")
    public R<List<ActNodeDef>> list(@RequestBody ActNodeDefReq req) {
        QueryWrapper queryWrapper = new QueryWrapper(req);
        List<ActNodeDef> list = iActNodeDefService.list(queryWrapper);
        return R.ok(list);
    }





    @GetMapping(value = "/{id}")
     @ApiOperation(value = "流程节点定义 单体查询")
    public R<ActNodeDef> getById(@PathVariable("id") String id) {
        ActNodeDef one=iActNodeDefService.getById(id);
        return R.ok(one);
    }

    @PostMapping(value = "/create")
     @ApiOperation(value = "流程节点定义 创建")
    public R<String> create(@RequestBody ActNodeDef params) {
        iActNodeDefService.save(params);
        return R.ok("创建成功");
    }

    @PostMapping(value = "/delete/{id}")
     @ApiOperation(value = "流程节点定义 删除")
    public R<String> delete(@PathVariable("id") String id) {
        iActNodeDefService.removeById(id);
        return R.ok("删除成功");
    }

    @PostMapping(value = "/update")
     @ApiOperation(value = "流程节点定义 更新")
    public R<String> update(@RequestBody ActNodeDef params) {
        iActNodeDefService.updateById(params);
        return R.ok("更新成功");
    }
}
